/**
 * @Author 天下无敌
 * @Date 
 * @AIDE AIDE+ 
 */package com.ecs.core;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.ecs.core.utils.JsonRegion;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.graphics.Color;

public class test extends Game
{
	//private String path = "MiniWorldSprites/Characters/Champions/Arthax.png";
	TextureRegion region;
	float stateTime = 0;
	ObjectMap<String,Animation<TextureRegion>> reg;
	Batch batch;
	AssetManager asset;
	public static class tt{
		public JsonRegion region;
	}
	@Override
	public void create()
	{
		/*JsonAnimation ja = new JsonAnimation();
		ja.texturePath = path;
		
		int index = 0;
		
		for(int i = 0;i < 4;i++){
			JsonAnimation.FrameCoordinate cs[] = new JsonAnimation.FrameCoordinate[4];
			for(int y = 0;y < 4;y++){
				cs[y] = new JsonAnimation.FrameCoordinate(i,y);
			}
			ja.animationsData.put("test" + i,cs);
			ja.frameDurations.put("test" + i,(float)(0.1f +(i * 0.1)));
			ja.frameHeight = 16;
			ja.frameWidth = 16;
		}
		Json json = new Json();
		json.setOutputType(JsonWriter.OutputType.json);
		json.setSerializer(JsonAnimation.class,new JsonAnimationSerializer());
		Gdx.files.external("animtest.json").writeString(json.prettyPrint(ja),false);
	}*/
	
	tt t = new tt();
	JsonRegion jr = new JsonRegion();
	jr.texturePath ="hhh";
	jr.regionHeight = 16;
	jr.regionWidth = 16;
	jr.regionX = 1;
	jr.regionY = 1;
	t.region = jr;
	
		/*Json json = new Json();
		json.setOutputType(JsonWriter.OutputType.json);
		Gdx.files.external("animtest.json").writeString(json.prettyPrint(t),false);
		
	    batch = new SpriteBatch();
	    asset = new AssetManager();
		asset.load(path,Texture.class);
		asset.finishLoading();
		reg = JsonAnimation.loadAnimations("animtest.json",asset);
		*/
		
	

	}

	@Override
	public void render()
	{
		super.render();
		ScreenUtils.clear(Color.BLUE);
	/*stateTime += Gdx.graphics.getDeltaTime();
		batch.begin();
		region = reg.get("test1").getKeyFrame(stateTime,true);
		batch.draw(region,0,0,500,500);
		region = reg.get("test2").getKeyFrame(stateTime,true);
		batch.draw(region,500,500,500,500);
		batch.end();*/
	}


}
